﻿<%@ Application Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<script runat="server">

    
    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
        Application["SoLuongTruyCap"] = 0;
    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown
        
    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs

    }

    void Session_Start(object sender, EventArgs e) 
    {
        
        // Code that runs when a new session is started
        Session["ThanhVien"] = "";
        Session["DangDangNhap"] = false;
        Session["HoTen"] = "";
        Session["MaQuyen"] = "";
        Session["sqlseachname"] = "";
        Session["IDGia"] = "";
        Application["SoLuongTruyCap"] = (int)Application["SoLuongTruyCap"] + 1;
        Session["KTTiemKiem"] = "";
        Session["IDThanhVien"] = "";
        //Khoi tao sesion gio hang`
        DataTable dt = new DataTable();
        dt.Columns.Add(new DataColumn("ID", typeof(string)));
        dt.Columns.Add(new DataColumn("TenSanPham", typeof(string)));
        dt.Columns.Add(new DataColumn("GiaTien", typeof(float)));
        dt.Columns.Add(new DataColumn("SoLuong", typeof(Int32)));
        dt.Columns.Add(new DataColumn("TongTien", typeof(float)));
        Session["cart"] = dt;
    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

    }
       
</script>
